﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yahoo.Yui.Compressor;

namespace Interfleet.SE.UICompiler.Core.YahooJavaScriptCompressor
{
    public class YJCompilerAgent : CompilerAgent
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="args"><see cref="Arguments"/> for the compiler.</param>
        internal YJCompilerAgent(Arguments args)
            : base(
            args, 
            new YJArgumentBuilder(args), 
            new YJResultBuilder(args)
            )
        {
        }


        public override CompileResult Compile()
        {
            var js = ArgumentBuilder.Build();
            var complationStart = DateTime.Now;
            var result = JavaScriptCompressor.Compress(js);
            return ResultBuilder.Build(result, complationStart);
        }
    }
}
